{extend name="admin@index_layout"/}
{block name="main"}
<link rel="stylesheet" href="__STATIC__/admin/css/cms.css">
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" method="post">
            <div class="layui-tab">
                <ul class="layui-tab-title">
                    <li class="layui-this"><i class="layui-icon layui-icon-set"></i> 基本设置</li>
                    {volist name="sites" id="site" key="i" }
                    <li> {if $site.mark} <img src="/static/lang/image/{$site.mark}.png" title="{$site.name}">{/if} {$site.name}</li>
                    {/volist}
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <input type="hidden" name="type" value="text" />
                        <div class="layui-form-item">
                            <label class="layui-form-label">碎片分类</label>
                            <div class="layui-input-block">
                                <select name="group">
                                    <option value="">==分类选择==</option>
                                    {volist name="langGroups" id="vo"}
                                    <option value="{$vo.id}" {eq name="vo.id" value="$info.group"}selected{/eq}>{$vo.name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">碎片标题</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" lay-verify="required" lay-reqText="碎片标题不能为空" value="{$info.title}" placeholder="碎片中文标题" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">一般由中文组成，仅用于显示</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">碎片名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" lay-verify="required" lay-reqText="碎片名称不能为空" value="{$info.name}"  placeholder="碎片英文名称" class="layui-input" {if $userInfo.id!=1}readonly="readonly"{/if}>
                            </div>
                            <div class="layui-form-mid layui-word-aux">由英文字母开头和下划线组成，如 <code>web_site_title</code></div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">默认值</label>
                            <div class="layui-input-block">
                                <input type="text" name="value" lay-verify="required" lay-reqText="碎片默认值不能为空" value="{$info.value}" placeholder="碎片默认值不能为空" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">其他语言站不输入时显示默认值</div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">碎片备注</label>
                            <div class="layui-input-block">
                                <textarea name="remark" placeholder="填写碎片说明" class="layui-textarea">{$info.remark}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序</label>
                            <div class="layui-input-block">
                                <input type="number" name="listorder" autocomplete="off" placeholder="只能是正整数" class="layui-input" value="{$info.listorder}">
                            </div>
                        </div>
                    </div>
                    {volist name="lang_data" id="s" key="k" }
                    <div class="layui-tab-item">
                        <input type="hidden" name="lang_data[{$k}][site_id]" value="{$s['site_id']}" />
                        <input type="hidden" name="lang_data[{$k}][lang_id]" value="{$s['lang_id']}" />
                        <input type="hidden" name="lang_data[{$k}][id]" value="{$s['id']|default=''}" />
                        <div class="layui-form-item">
                            <label class="layui-form-label">数据</label>
                            <div class="layui-input-block">
                                <textarea lay-verify="required" lay-reqText="数据不能为空" name="lang_data[{$k}][value]" placeholder="请输入数据" class="layui-textarea">{$s['value']|default=''}</textarea>
                            </div>
                        </div>
                    </div>
                    {/volist}

                </div>

                <input type="hidden" name="id" value="{$info.id}">
                <div class="layui-form-item layer-footer">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit>立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznForm', function() {
        var yznForm = layui.yznForm;
        yznForm.listen();
    });
</script>
{/block}